<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.infodms.dms.common.Constant"%>
<%
	String contextPath = request.getContextPath();
	String isSpecialCar = String.valueOf(request.getAttribute("isSpecialCar"));
%>
<%@taglib uri="/jstl/cout" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jsp:include page="${contextPath}/common/jsp_head_new.jsp" />
<title>经销商新增地址申请</title>
<script type="text/javascript">
function doInit()
{  
	genLocSel('txt1','txt2','txt3','${province}','${city}','${area}'); // 加载省份城市和县
	var status = '${status}';
	if("10011001" == status+""){
		document.getElementById("addCode").disabled = "disabled";
		document.getElementById("address").disabled = "disabled";
		document.getElementById("receiveOrg").disabled = "disabled";
		document.getElementById("txt1").disabled = "disabled";
		document.getElementById("txt2").disabled = "disabled";
		document.getElementById("txt3").disabled = "disabled";
		document.getElementById("remark").disabled = "disabled";
		//document.getElementById("divId").disabled = "disabled";
		document.getElementById("queryBtn1").style.display = "none";
	}
	var receive_org = '${addressInfo.RECEIVE_ORG }';
	if(receive_org){
		document.getElementById("receiveOrg").value = receive_org;
	}
}
</script>
</head>
<body>
<div class="wbox">
<div class="navigation"><img src="<%=contextPath%>/img/nav.gif" />&nbsp;当前位置：采购管理 &gt; 库存管理 &gt; 经销商新增地址申请&gt; 经销商地址信息</div>
<form id="fm" name="fm" method="post">
<input type="hidden" name="curPage" id="curPage" value="1" /> <input type="hidden" id="dlrId" name="dlrId" value="" />
<table class="table_query" border="0">
	<tr>
		<td class="tblopt" nowrap="nowrap" >
			<div align="right">业务范围：</div>
		</td>
		<td colspan="7">${areaName }</td>
	</tr>
	<tr>
		<td class="tblopt" nowrap="nowrap" > 
			<div align="right">地址代码：</div>
		</td>
		<td colspan="7"><input type="text" id="addCode" name="addCode" class="middle_txt" value="${addCode }" datatype="0,is_textarea,20" maxlength="20" readonly="readonly"/></td>
	</tr>
	<tr>
	    <td class="tblopt" nowrap="nowrap" ><div align="right">省份：</div></td>
	    <td nowrap="nowrap" ><select class="short_sel" id="txt1" name="province" onchange="_genCity(this,'txt2')"></select><font color="red">*</font> </td>
        <td class="tblopt" nowrap="nowrap" ><div align="right">地级市：</div></td>
	    <td nowrap="nowrap" ><select class="short_sel" id="txt2" name="city"  onchange="_genCity(this,'txt3')" ></select><font color="red">*</font></td>  
	    <td class="tblopt" nowrap="nowrap" ><div align="right">县：</div></td>
	    <td width="40%" nowrap="nowrap" ><select class="short_sel" id="txt3" name="area" ></select><font color="red">*</font></td>
	</tr>
	<tr>	
		<td class="tblopt" nowrap="nowrap" >
			<div align="right">街道地址：</div>
		</td>
		<td width="40%" colspan="7">
		<input type="text" id="address" name="address" class="long_txt" value="${address }" datatype="0,is_textarea,100" size="80" style="width:320px" />
		<input type="button" class="long_btn" onclick="queryAllAdd();" value="已维护地址" style="width:70px" />
		</td>
	</tr>
	<tr>
		<td class="tblopt" nowrap="nowrap" >
			<div align="right">联系人：</div>
		</td>
		<td nowrap="nowrap" ><input type="text" id="linkMan" name="linkMan" class="middle_txt" value="${addressInfo.LINK_MAN }" datatype="0,is_textarea,10" /></td>
		<td class="tblopt" nowrap="nowrap" >
			<div align="right">电话：</div>
		</td>
		<td colspan="3"><input type="text" id="tel" name="tel" value="${addressInfo.TEL }" class="middle_txt" datatype="0,is_textarea,40" maxlength="40" /></td>
	</tr>
	<tr>
		<td class="tblopt" nowrap="nowrap" >
			<div align="right">备注：</div>
		</td>
		<td colspan="5" nowrap="nowrap" ><input type="text" id="remark" name="remark" class="long_txt" value="${addressInfo.REMARK }" size="80" /></td>
	</tr>
	<tr>
		<td>
		</td>
		<td>
			<input type="button" class="normal_btn" onclick="saveOrSubmitAddress(1);" value="保 存" id="queryBtn" />
			<input type="button" class="normal_btn" onclick="saveOrSubmitAddress(2);" value="提 交" id="queryBtn1" />
			<input type="hidden" id="addressId" name="addressId" value="${addressInfo.ID }" />
			<input type="hidden" id="dealerId" name="dealerId" value="${dealerId }" />
			<input type="hidden" id="status" name="status" value="${status }" />
		</td>
		<td><input type="hidden" id="areaId" name="areaId" value="${areaId }" /></td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
</table>
</form>
</div>
<script type="text/javascript">

	function queryAllAdd(){
		OpenHtmlWindow('<%=request.getContextPath()%>/sales/storageManage/AddressAddApply/queryAllAdd.do',900,500);
	}

	function saveOrSubmitAddress(flag){ 
		var txt1 = document.getElementById("txt1").value;
		var txt2 = document.getElementById("txt2").value;
		var txt3 = document.getElementById("txt3").value;
		if(txt1.length==0){
			MyAlert("请选择'省份'!");
			return;
		}
		if(txt2.length==0){
			MyAlert("请选择'地级市'!");
			return;
		}
		if(txt3.length==0){
			MyAlert("请选择'县'!");
			return;
		}
		if(submitForm('fm')){
			if("1" == flag+""){
				MyConfirm("是否保存?",submitAction,[flag]);
			}
			if("2" == flag+""){
				MyConfirm("是否提交?",submitAction,[flag]);
			}
		}
	}
	function submitAction(flag){
		fm.action = "<%=request.getContextPath()%>/sales/storageManage/AddressAddApply/saveOrSubmit.do?flag="+flag;
		fm.submit();
	}

	function province(province,city,area){
		genLocSel('txt1','txt2','txt3',province,city,area);
	}
</script>
</body>
</html>